// 云函数入口文件
const cloud = require('wx-server-sdk')

cloud.init()
const db = cloud.database();
// 云函数入口函数
exports.main = async(event, context) => {
  let openid = event.userInfo.openId;
  let data = {};
  if (event.status) {
    data = {
      _openid: openid,
      order_status: event.status
    };
  } else {
    data = {
      _openid: openid
    }
  }
  console.log(data)
  try {
    return await db.collection('tb_address_list').get()
  } catch (e) {
    console.warn('网络错误')
  }
}